<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("modelConfigPath", "stock");
%>
<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<style type="text/css">
	.form-detailed .heading-btn.pull-right-important{float:right !important;}
	.table-responsive{margin: 0px 10px 0px 10px !important;}
	td input{margin-top:-1px;margin-bottom:-1px;height:23px; width:100%;border:none;color:red}
</style> 
<t:form id="form" modelAttribute=""  method="POST" action="/stock/inventory/saveInventoryShow" cssClass="form-horizontal">
	<input type="hidden" value='${inventory.inventoryId}' id="inventoryId" name="inventoryId"/> 
	<input type="hidden" value='${inventory.inventoryState}' id="inventoryState" name="inventoryState"/>
	<input type="hidden" value="${inventory.endType}" id="endType" name="endType"/> 
	<input type="hidden" value="${inventory.inventoryType}" id="inventoryType" name="inventoryType"/>
	<input type="hidden" value="${inventory.createUserId}" id="createUserId" name="createUserId"/>
	
	
	<t:panel cssClass="panel-flat form-detailed" customBody="true" customHead="true">
		<div class="table-responsive">
			<div style="height:548px;overflow-y:auto; overflow-x:auto;" >
				<table class="table table-bordered text-left">
				   <tr>
				   	  <td >盘点单号</td>	 
				   	  <td >${inventory.inventoryNo}</td> 
				   	  <td >盘点日期</td>
				   	  <td ><fmt:formatDate value="${inventory.createDate}" type="date" dateStyle="default" pattern="yyyy-MM-dd HH:MM:SS"/></td>
				   	  <td >盘点人</td>	 
				   	  <td >${inventory.createUserName}</td> 
				   </tr>
				   <tr>
				   	  <td >盘盈数</td>
				   	  <td ><input name="overageNum" type="text" id="overageNum" value="${inventory.overageNum}"/></td>
				   	  <td >盘亏数</td>
				   	  <td ><input name="lossNum" type="text" id="lossNum" value="${inventory.lossNum}"/></td>
				   	  <td >实际数</td>
				   	  <td ><input name="actualNum" type="text" id="actualNum" value="${inventory.actualNum}"/></td>
				   	  <td >账面数</td>
				   	  <td ><input name="bookNum" type="text" id="bookNum" value="${inventory.bookNum}"/></td>
				   </tr>  
				   <tr>
				   	  <td >盘盈种类数</td>
				   	  <td ><input name="overageTypeNum" type="text" id="overageTypeNum" value="${inventory.overageTypeNum}"/></td>
				   	  <td >盘亏种类数数</td>
				   	  <td ><input name="lossTypeNum" type="text" id="lossTypeNum" value="${inventory.lossTypeNum}"/></td>
				   	  <td >实际种类数</td>
				   	  <td ><input name="actuaTypelNum" type="text" id="actuaTypelNum" value="${inventory.actuaTypelNum}"/></td>
				   	  <td >账面种类数</td>
				   	  <td ><input name="bookTypeNum" type="text" id="bookTypeNum" value="${inventory.bookTypeNum}"/></td>
				   </tr>
				</table>
				<table class="cntable table table-bordered dataTable table-serveProject">
					<thead>
						<tr>
							<th>序号</th>
							<th>编号</th>
				            <th>名称</th>
				            <th>盘盈数</th>
				            <th>盘亏数</th>
				            <th>账面数</th>
				            <th>实际数</th>
				            <th>属性</th>
				            <th>盘盈/亏数</th>
				            <th>账面库存</th>
				            <th>实盘库存</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach var="inventoryShow" items="${inventoryShows}"  varStatus="status">
							<c:set var="trShow"  value="0"/>
							<c:set value="" var="trColor" />
							<tr data-id="${inventoryShow.showId}">
								<c:forEach var="inventoryCollocation" items="${inventoryShow.inventoryCollocations}">
									<input type="hidden" value='${outStockShow.cargoId}' id="cargoId" name="cargoId"/>
									<input type="hidden" value='${inventoryCollocation.collocationId}' id="collocationId" name="collocationId"/>
									<c:set var="trShow"  value="${trShow +1}"/>
									<c:if test="${trShow == 1}" >
										<td rowspan="${fn:length(inventoryShow.inventoryCollocations)}">${status.index+1}</td>
										<td rowspan="${fn:length(inventoryShow.inventoryCollocations)}">${inventoryShow.cargo.cargoNo}</td>
										<td rowspan="${fn:length(inventoryShow.inventoryCollocations)}">${inventoryShow.cargo.cargoName}</td>
										<td rowspan="${fn:length(inventoryShow.inventoryCollocations)}">${inventoryShow.overageNumShow}</td>
										<td rowspan="${fn:length(inventoryShow.inventoryCollocations)}">${inventoryShow.lossNumShow}</td>
										<td rowspan="${fn:length(inventoryShow.inventoryCollocations)}">${inventoryShow.actualNumShow}</td>
										<td rowspan="${fn:length(inventoryShow.inventoryCollocations)}">${inventoryShow.bookNumShow}</td>
										<td>${inventoryCollocation.collocation.propertyNameOne}/${inventoryCollocation.collocation.propertyNameTwo}</td>
										<c:if test="${inventoryCollocation.overageNumCollocation > 0 }" >
											<td>${inventoryCollocation.overageNumCollocation}</td>
										</c:if>
										<c:if test="${inventoryCollocation.lossNumCollocation < 0 }" >
											<td>${inventoryCollocation.lossNumCollocation}</td>
										</c:if>
										<c:if test="${inventoryCollocation.overageNumCollocation == 0 && inventoryCollocation.lossNumCollocation == 0}" >
											<td>${inventoryCollocation.lossNumCollocation}</td>
										</c:if>
										
										<td>${inventoryCollocation.bookNumCollocation}</td>
										<td><input style="ime-mode:disabled" onkeyup="return ValidateNumber(this,value)" name="actualNumCollocation" type="text" value="${inventoryCollocation.actualNumCollocation}"/></td>
									</c:if>
									<c:if test="${trShow > 1}" >
										<tr data-id="${inventoryCollocation.inventoryCollocationId}">
											<td>${inventoryCollocation.collocation.propertyNameOne}/${inventoryCollocation.collocation.propertyNameTwo}</td>
											<c:if test="${inventoryCollocation.overageNumCollocation > 0 }" >
												<td>${inventoryCollocation.overageNumCollocation}</td>
											</c:if>
											<c:if test="${inventoryCollocation.lossNumCollocation < 0 }" >
												<td>${inventoryCollocation.lossNumCollocation}</td>
											</c:if>
											<c:if test="${inventoryCollocation.overageNumCollocation == 0 && inventoryCollocation.lossNumCollocation == 0}" >
												<td>${inventoryCollocation.lossNumCollocation}</td>
											</c:if>
											<td>${inventoryCollocation.bookNumCollocation}</td>
											<td><input style="ime-mode:disabled" onkeyup="return ValidateNumber(this,value)" name="actualNumCollocation" type="text" value="${inventoryCollocation.actualNumCollocation}"/></td>
										</tr>
									</c:if>
								</c:forEach>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
		</div>
	</t:panel>
</t:form>
<script type="text/javascript">


//输入框数字输入限制
function ValidateNumber(e, pnumber){
	if (!/^\d+[.]?\d*$/.test(pnumber))
	{
	e.value = /^\d+[.]?\d*/.exec(e.value);
	}else{
		updateSumInfo();
 	}
	return false;
}	
</script>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formbuttons.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>